# -*- coding: utf-8 -*-
# @Time : 2024/2/19 9:24
# @Author : ZH
# @File : 590.py
# @Software: PyCharm
"""
# Definition for a Node.
class Node:
    def __init__(self, val=None, children=None):
        self.val = val
        self.children = children
"""

from typing import List

class Solution:
    def postorder(self, root: 'Node') -> List[int]:

        ans = []

        def asy(node):
            if node is None:
                return

            for chi in node.children:
                asy(chi)
            ans.append(node.val)

        asy(root)
        return ans

